package com.solocredit.finance.data.dev.take

import android.content.Context
import com.google.gson.Gson
import com.solocredit.finance.data.dev.utils.FlexiMolaSdUtil
import com.solocredit.finance.data.dev.utils.gzipString

/**
 * Storage
 */
class TakeFlexiMolaSd(val context: Context) {

    fun takeFlexiMolaSd(): String? {
        return try {
            val data = hashMapOf<String, Any>().apply {
                put("imei", "")
                put("containSd", FlexiMolaSdUtil.youKa())
                put("ramCanUse", FlexiMolaSdUtil.remaiSiz(context))
                put("ramTotal", FlexiMolaSdUtil.talRSzi(context))
                put("cashCanUse", FlexiMolaSdUtil.disRema())
                put("cashTotal", FlexiMolaSdUtil.toaDis())
                put("extraSD", FlexiMolaSdUtil.isYoKa())
                put("internalTotal", FlexiMolaSdUtil.talInerSiz(context))
                put("internalAvailable", FlexiMolaSdUtil.avalInerSiz(context))
                put("ramDidUsed", FlexiMolaSdUtil.useSiz(context))
                put("cashDidUsed", FlexiMolaSdUtil.dissee())
                put("sdCardTotal", FlexiMolaSdUtil.toaYoKa())
            }
            Gson().toJson(data).trim().gzipString()

        } catch (e: Exception) {
            null
        }
    }
}